
/**
 * Copyright 2009 cestum.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
package org.waveprotocol.wave.model.document.operation.algorithm {
/**
 * An pair of strings representing an update of a string value.
 */
public final class ValueUpdate {

	public var oldValue:String;
	public var newValue:String;

	public function ValueUpdate(oldValue:String, newValue:String) {
    this.oldValue = oldValue;
    this.newValue = newValue;
  }

  
//  public function hashCode():int {
//    var prime:int= 31;
//    var result:int= 1;
//    result = prime * result + ((newValue == null) ? 0: newValue.hashCode());
//    result = prime * result + ((oldValue == null) ? 0: oldValue.hashCode());
//    return result;
//  }

  
  public function equals(obj:Object):Boolean {
    if (this == obj) return true;
    if (obj == null) return false;
    if (!(obj is ValueUpdate)) return false;
    var other:ValueUpdate= ValueUpdate(obj);
    if (newValue == null) {
      if (other.newValue != null) return false;
    } else if (!newValue == other.newValue) return false;
    if (oldValue == null) {
      if (other.oldValue != null) return false;
    } else if (!oldValue==other.oldValue) return false;
    return true;
  }

}
}